package com.hualan.controller;

import com.hualan.domain.Teacher;
import com.hualan.service.TeacherService;
import com.hualan.util.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/Teacher")
public class TeacherController {
    @Autowired
    public TeacherService teacherService;

    @GetMapping("/selectAllTeacher")
    public R selectAllTeacher(){
        List<Teacher> teacherList= teacherService.selectAllTeacher();
        if (teacherList.size()>0){
            return R.success(teacherList);
        }else {
            return R.fail(teacherList);
        }
    }

    //新增咨询师信息
    @PostMapping("/insertTeacher")
    public R insertTeacher(Teacher teacher){
        return R.success(teacherService.insertTeacher(teacher));
    }
}
